/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package db;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author devashish
 */
@Entity
@Table(name = "word")
@NamedQueries({
    @NamedQuery(name = "Word.findAll", query = "SELECT w FROM Word w"),
    @NamedQuery(name = "Word.findByWordId", query = "SELECT w FROM Word w WHERE w.wordId = :wordId"),
    @NamedQuery(name = "Word.findByHashCode", query = "SELECT w FROM Word w WHERE w.hashCode = :hashCode"),
    @NamedQuery(name = "Word.findByWord", query = "SELECT w FROM Word w WHERE w.word = :word")})
public class Word implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "WordId")
    private Long wordId;
    @Basic(optional = false)
    @Column(name = "HashCode")
    private int hashCode;
    @Basic(optional = false)
    @Column(name = "Word")
    private String word;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "word")
    private Collection<Results> resultsCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "word1")
    private Collection<Results> resultsCollection1;

    public Word() {
    }

    public Word(Long wordId) {
        this.wordId = wordId;
    }

    public Word(Long wordId, int hashCode, String word) {
        this.wordId = wordId;
        this.hashCode = hashCode;
        this.word = word;
    }

    public Long getWordId() {
        return wordId;
    }

    public void setWordId(Long wordId) {
        this.wordId = wordId;
    }

    public int getHashCode() {
        return hashCode;
    }

    public void setHashCode(int hashCode) {
        this.hashCode = hashCode;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }

    public Collection<Results> getResultsCollection() {
        return resultsCollection;
    }

    public void setResultsCollection(Collection<Results> resultsCollection) {
        this.resultsCollection = resultsCollection;
    }

    public Collection<Results> getResultsCollection1() {
        return resultsCollection1;
    }

    public void setResultsCollection1(Collection<Results> resultsCollection1) {
        this.resultsCollection1 = resultsCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (wordId != null ? wordId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Word)) {
            return false;
        }
        Word other = (Word) object;
        if ((this.wordId == null && other.wordId != null) || (this.wordId != null && !this.wordId.equals(other.wordId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "db.Word[wordId=" + wordId + "]";
    }

}
